import { createRouter,createWebHashHistory } from "vue-router";
// import store from '../store'
import Home from "../views/Home/index/index.vue";
// import Brandspecial from "../views/Home/Brandspecial/index.vue"
import BrandDetails from "../views/Home/BrandDetails/index.vue"
import Dailysaledetails from "../views/Home/Dailysaledetails/index.vue"
import Findnew from "../views/Home/Findnew/index.vue"
import Findnewproducts from "../views/Home/Findnewproducts/index.vue"
import OverseasArea from "../views/Home/OverseasArea/index.vue"
import Findthefactory from "../views/Home/Findthefactory/index.vue"
import AllGoods from "../views/search/AllGoods.vue";
import Set from "../views/set/index.vue";
import Option from "../views/set/option.vue";
import SureOrder from "../views/set/sureOrder.vue";
import Pay from "../views/set/pay.vue";
import goodsCar from "../views/set/goodsCar.vue";
import GoodsDetail from "../views/goodsDetail/goodsDetail.vue";
import Store from "../views/store/store.vue";
import Factory from "../views/factory/factory.vue";
import Message from "../views/message.vue";
import OrderHome from "../views/order/orderHome.vue";
import OrderDetail from "../views/order/orderDetail.vue";
import RefundAndSales from "../views/order/refundAndSales.vue";
import RedundInput from "../views/order/redundInput.vue";
import Refund from "../views/order/refund.vue";
import Comment from "../views/order/comment.vue";
import CommentSuccess from "../views/order/commentSuccess.vue";
import BrowsingHistory from "../views/userInfo/browsingHistory.vue";
import UserInfo from "../views/userInfo/wallet.vue";
import Cart from "../views/userInfo/cart.vue";
import Collect from "../views/userInfo/collect.vue";
import Attention from "../views/userInfo/attention.vue";
import RefundOrderDetail from "../views/order/refundOrderDetail.vue";
import Logistics from "../views/order/logistics.vue";


const routes = [
    { path: "/", name: "Home", component: Home },

    // {path:"/index/Brandspecial",name:"Brandspecial",component:Brandspecial},

// <<<<<<< HEAD
// {path:"/index/BrandDetails",name:"BrandDetails",component:BrandDetails},
// {path:"/index/Dailysaledetails",name:"Dailysaledetails",component:Dailysaledetails},
// {path:"/index/Findnew",name:"Findnew",component:Findnew},
// {path:"/index/Findnewproducts",name:"Findnewproducts",component:Findnewproducts},
// {path:"/index/OverseasArea",name:"OverseasArea",component:OverseasArea},
// {path:"/index/Findthefactory",name:"Findthefactory",component:Findthefactory},
// {path:"/allGoods",name:"AllGoods",component:AllGoods},
// {path:"/goodsDetail",name:"GoodsDetail",component:GoodsDetail},
// {path:"/Set",name:"Set",component:Set},
// {path:"/Option",name:"Option",component:Option},  //意见反馈 已完成
// {path:"/SureOrder",name:"SureOrder",component:SureOrder},
// {path:"/Pay",name:"Pay",component:Pay},
// {path:"/goodsCar",name:"goodsCar",component:goodsCar},
// {path:"/store",name:"Store",component:Store},
// {path:"/factory",name:"Factory",component:Factory},
// {path:"/message",name:"Message",component:Message},
// {path:"/order/orderHome",name:"OrderHome",component:OrderHome},
// {path:"/order/orderDetail",name:"OrderDetail",component:OrderDetail},
// {path:"/order/refundAndSales",name:"refundAndSales",component:RefundAndSales},
// {path:"/order/redundInput",name:"RedundInput",component:RedundInput},
// {path:"/order/refund",name:"Refund",component:Refund},
// {path:"/order/comment",name:"Comment",component:Comment},
// {path:"/order/commentSuccess",name:"CommentSuccess",component:CommentSuccess},
// {path:"/order/refundOrderDetail",name:"RefundOrderDetail",component:RefundOrderDetail},
// {path:"/browsingHistory",name:"BrowsingHistory",component:BrowsingHistory},
// {path:"/userInfo",name:"UserInfo",component:UserInfo}, // 钱包
// {path:"/cart",name:"Cart",component:Cart},
// {path:"/collect",name:"Collect",component:Collect},
// {path:"/attention",name:"Attention",component:Attention},
// {path:"/logistics",name:"Logistics",component:Logistics}, //物流
// =======
    { path: "/index/BrandDetails", name: "BrandDetails", component: BrandDetails },
    { path: "/index/Dailysaledetails", name: "Dailysaledetails", component: Dailysaledetails },
    { path: "/index/Findnew", name: "Findnew", component: Findnew },
    { path: "/index/Findnewproducts", name: "Findnewproducts", component: Findnewproducts },
    { path: "/index/OverseasArea", name: "OverseasArea", component: OverseasArea },
    { path: "/index/Findthefactory", name: "Findthefactory", component: Findthefactory },
    { path: "/allGoods", name: "AllGoods", component: AllGoods },
    { path: "/goodsDetail", name: "GoodsDetail", component: GoodsDetail },
    { path: "/Set", name: "Set", component: Set },
    { path: "/Option", name: "Option", component: Option },  //意见反馈 已完成
    { path: "/SureOrder", name: "SureOrder", component: SureOrder },
    { path: "/Pay", name: "Pay", component: Pay },
    { path: "/goodsCar", name: "goodsCar", component: goodsCar },
    { path: "/store", name: "Store", component: Store },
    { path: "/factory", name: "Factory", component: Factory },
    { path: "/message", name: "Message", component: Message },
    { path: "/order/orderHome", name: "OrderHome", component: OrderHome },
    { path: "/order/orderDetail", name: "OrderDetail", component: OrderDetail },
    { path: "/order/refundAndSales", name: "refundAndSales", component: RefundAndSales },
    { path: "/order/redundInput", name: "RedundInput", component: RedundInput },
    { path: "/order/refund", name: "Refund", component: Refund },
    { path: "/order/comment", name: "Comment", component: Comment },
    { path: "/order/commentSuccess", name: "CommentSuccess", component: CommentSuccess },
    { path: "/order/refundOrderDetail", name: "RefundOrderDetail", component: RefundOrderDetail },
    { path: "/browsingHistory", name: "BrowsingHistory", component: BrowsingHistory },
    { path: "/userInfo", name: "UserInfo", component: UserInfo }, // 钱包
    { path: "/cart", name: "Cart", component: Cart },
    { path: "/collect", name: "Collect", component: Collect },
    { path: "/attention", name: "Attention", component: Attention },
    { path: "/logistics", name: "Logistics", component: Logistics }, //物流
    // { path: "/coupone", name: "Coupone", component: Coupone }, //物流
    // { path: "/findSimilarity", name: "FindSimilarity", component: FindSimilarity }, //找相似
    // { path: "/myCoupone", name: "MyCoupone", component: MyCoupone }, //找相似


];

const router = createRouter({
    history: createWebHashHistory(),
    routes
})
//前置路由
// to要去的路由信息 
// from要离开的路由信息
// next是否要放行，默认放行，next(false)不放行
// 全局路由守卫: 根据token判断，如果没有则返回登录页面，如果有则放行
// router.beforeEach((to, from, next) => {
//     if (!localStorage.getItem('token')) { // 如果没有
//         if (to.name == "login") { // 判断是否要去登陆界面如果是则放行
//             next()
//         } else { // 否则直接跳转登录界面
//             router.push('/')
//             store.commit("updateInfo", true);
//         }
//     } else { // 如果有则放行
//         next()
//     } 
// })
export default router; 